import Axios from "./../utils/axios";
import api from "./../api/index"


//--------资产存放模块---------------

/**
 * 新增存放地点
 * @param {*} user 
 * @returns 
 */
function storageAdd(user) {
    return Axios({
      url: '/storage/add',
      method: 'post',
      data: user
    })
  }




/**
 * 查询用户列表接口
 * @param {*} page 
 * @param {*} limit 
 * @param {*} queryParam 
 * @returns 
 */
 function findUserList(storageDto) {
    return Axios({
      url: `/storage/list`,
      method: 'post',
      data:storageDto
    })
  }


  /**
   * 查询
   * @param {*} StorageSite 
   * @returns 
   */
  function findStorageByName(StorageSite){
    return Axios({
      url: `/storage/findStorageByName`,
      method: 'post',
      data: StorageSite
    })
  }



/**
 *  编辑用户接口
 * @param {*} user 
 * @returns 
 */
 function storageUpdate(user) {
    return Axios({
      url: `/storage/update`,
      method: 'post',
      data: user
    })
  }


  /**
   * 删除地点
   * @param {*} id 
   * @returns 
   */
 function delStorage(id) {
    return Axios({
      url: `/storage/delete/${id}`,
      method: 'get'
    })
  }




//--------------审批模块----------------

/**
 * 审配人更换
 * @param {} applyUser 
 * @returns 
 */
function addApplyPerson(applyUser){
  return Axios({
    url:`/apply/applyPerson`,
    method:'post',
    data:applyUser
  })
}


/**
 * 添加审批人
 * @param {*} ids 
 * @param {*} number 
 * @returns 
 */
function applyPerson(ids,number){
  return Axios.post("/apply/applyPerson",{ids,number})
}


/**
 * 用户列表
 * @param {*} UserQueryDto 
 * @returns 
 */
function queryAll(UserQueryDto){
  return Axios({
    url:`/admin/queryAll`,
    method:'post',
    data:UserQueryDto
  })
}



/**
 * 根据用户名查询
 * @param {*} user 
 * @returns 
 */
function findUserName(user){
  return Axios({
    url: `/apply/findUserByName`,
    method: 'post',
    data: user
  })
}






//------------资产分类设置模块-------------


/**
 * 新增资产分类
 * @param {*} classDto 
 * @returns 
 */
function classAdd(classDto){
    return Axios({
      url:`/class/classAdd`,
      method:'post',
      data:classDto
    })
}




/**
 * 类别查询
 * @param {*} number 
 * @param {*} ClassroomVo 
 * @returns 
 */
function classroom(number,ClassroomVo){
  return Axios({
    url:`/class/classroom/${number}`,
    method:'get',
    data:ClassroomVo
  })
}





/**
 * 删除资产分类
 * @param {*} id 
 * @returns 
 */
function deleteClass(id){
    return Axios.post(api.Infrastructure.delClass,{id})
}





export default{
    storageAdd,
    findUserList,
    storageUpdate,
    delStorage,
    classAdd,
    deleteClass,
    addApplyPerson,
    classroom,
    findStorageByName,
    queryAll,
    findUserName,
    applyPerson
}